package cn.com.zetatech.loader.common.enums;

import org.apache.commons.lang3.StringUtils;

import java.util.Arrays;
import java.util.stream.Collectors;

public enum JobStateEnums {

	POLLING("POLLING","文件轮询中"), LOADING("LOADING","文件解析中"), END("END","任务完成");

	private String value;
	private String desc;
	public String value(){
		return value;
	}
	public String desc() {
		return desc;
	}

	JobStateEnums(String value,String desc){
		this.value = value;
		this.desc = desc;
	}

	public static String getDesc(String value) {
		if(StringUtils.isEmpty(value)) {
			return "";
		}
		try {
			return Arrays.asList((JobStateEnums.values())).stream().filter(item->StringUtils.equals(item.value(), value))
					.distinct().collect(Collectors.toList()).get(0).desc;
		}catch(Exception e) {
			return "";
		}

	}
}
